package com.ruoyi.project.tickets.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.tickets.mapper.SaleDetailsMapper;
import com.ruoyi.project.tickets.domain.SaleDetails;
import com.ruoyi.project.tickets.service.ISaleDetailsService;

/**
 * 销售详情Service业务层处理
 * 
 * @author 孙山伟
 * @date 2023-07-01
 */
@Service
public class SaleDetailsServiceImpl implements ISaleDetailsService 
{
    @Autowired
    private SaleDetailsMapper saleDetailsMapper;

    /**
     * 查询销售详情
     * 
     * @param id 销售详情ID
     * @return 销售详情
     */
    @Override
    public SaleDetails selectSaleDetailsById(Long id)
    {
        return saleDetailsMapper.selectSaleDetailsById(id);
    }

    /**
     * 查询销售详情列表
     * 
     * @param saleDetails 销售详情
     * @return 销售详情
     */
    @Override
    public List<SaleDetails> selectSaleDetailsList(SaleDetails saleDetails)
    {
        return saleDetailsMapper.selectSaleDetailsList(saleDetails);
    }

    /**
     * 新增销售详情
     * 
     * @param saleDetails 销售详情
     * @return 结果
     */
    @Override
    public int insertSaleDetails(SaleDetails saleDetails)
    {
        saleDetails.setCreateTime(DateUtils.getNowDate());
        return saleDetailsMapper.insertSaleDetails(saleDetails);
    }

    /**
     * 修改销售详情
     * 
     * @param saleDetails 销售详情
     * @return 结果
     */
    @Override
    public int updateSaleDetails(SaleDetails saleDetails)
    {
        saleDetails.setUpdateTime(DateUtils.getNowDate());
        return saleDetailsMapper.updateSaleDetails(saleDetails);
    }

    /**
     * 批量删除销售详情
     * 
     * @param ids 需要删除的销售详情ID
     * @return 结果
     */
    @Override
    public int deleteSaleDetailsByIds(Long[] ids)
    {
        return saleDetailsMapper.deleteSaleDetailsByIds(ids);
    }

    /**
     * 删除销售详情信息
     * 
     * @param id 销售详情ID
     * @return 结果
     */
    @Override
    public int deleteSaleDetailsById(Long id)
    {
        return saleDetailsMapper.deleteSaleDetailsById(id);
    }
}
